# -*- coding: utf-8 -*-
#
# @Time    ： 2024/4/3  13:20
# @Auther  ： 徐良
# File     :  dbService.py

# mysql 连接
from PySide6.QtSql import QSqlDatabase
import share.globalvar as gol
from share.bioDialog import Infomation

# 连接sqlite数据库
def connect_sqlite():
    import os
    # 获取当前路径
    current_path = os.path.dirname(os.path.abspath(__file__))
    print(current_path)
    currentPath = gol.getValue('currentPath')
    # 构建数据库文件的绝对路径
    dbname = currentPath + '/data/autoTask.db'
    db2 = QSqlDatabase.addDatabase('QSQLITE', 'connectionSqlite')
    db2.setDatabaseName(dbname)
    if db2.open():
        return db2
    else:
        return None


DB_Sqlite = connect_sqlite()


DB_MySql = None





